-------------------------------------------------------------------------------
--	 File name: shared.lua
--		Author: Sploder
-- 		  Date: 03/01/2010
-- Description: This file contains the definitions shared between the client
--					and the server for Sakuyas's normal (RED) knives.
--
-------------------------------------------------------------------------------

-- Define the entity's spawn info.
ENT.Type			= "anim"
ENT.Base			= "base_entity"
ENT.PrintName		= "Knife"
ENT.Author			= "Sploder"
ENT.Contact			= ""
ENT.Purpose			= ""
ENT.Instructions	= "For weapon use only"

-------------------------------------------------------------------------------
--	  Function: ENT:Initialize()
-- Description: This function initializes the entity.
-------------------------------------------------------------------------------
function ENT:Initialize()
	if (SERVER)
	then
		local s = 4				-- The "radius" of the object's bounding box.
	
		self.dead = false		-- Set the thing to have not died yet.
		self.bounces = 0		-- This keeps track of how many times the entity has bounced.
		self.bouncesMax = 4		-- This is the maximum number of times the entity can bounce before dying.
		self.damage		= 10		-- This is the amount of damage the knife does on impact.
		self.timer = CurTime() + 20	-- This is the time at which the entity will die, regardless of bounces.
		self.pPerHit	= 0
		self.pPerKill	= 0
				
		self.Entity:SetModel("models/danmaku/sakuya/knife01.mdl")	-- Set the model.
			
		self.Entity:PhysicsInitSphere(s)										-- Create a ball for collisions.
		self.Entity:SetCollisionBounds(Vector( -s, -s, -s), Vector( s, s, s))	-- Create a bounding box.
		self.Entity:SetMoveType(MOVETYPE_VPHYSICS)	-- Set moving for physics.
		self:SetTrigger(true)
		self:DrawShadow(false)						-- Don't draw shadows for this thing.
		self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS)
		
	else
		self.dead = false			-- This keeps track of whether the entity is alive or not.
	end
end